/**
 * 版权所有：厦门市巨龙信息科技有限公司
 * Copyright 2024 Xiamen Dragoninfo Eng. Co. Ltd.
 * All right reserved.
 */
package com.github.alfred.ddd.core.event;

import cn.hutool.core.util.IdUtil;

import java.time.LocalDateTime;

/**
 * 类说明
 *
 * @author chengh
 * @date 2024/1/11 16:47
 */
public abstract class ApplicationEvent implements Event {
    protected final String eventId;
    protected final String createdTimestamp;
    protected final String version;

    public ApplicationEvent() {
        this("v1.0");
    }

    public ApplicationEvent(String version) {
        eventId = IdUtil.objectId();
        createdTimestamp = LocalDateTime.now().toString();
        this.version = version;
    }

    @Override
    public String eventId() {
        return eventId;
    }
}
